import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_boost/flutter_boost.dart';
import 'package:flutter_module/controller/four_controller.dart';
import 'package:flutter_module/router/routers.dart';
import 'package:flutter_module/util/language_res/str_res_keys.dart';
import 'package:flutter_module/util/log_u.dart';
import 'package:get/get.dart';

class FourPage extends StatefulWidget {
  @override
  _FourPage createState() => _FourPage();
}

class _FourPage extends State<FourPage> {
  final _controller = Get.find<FourController>();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      extendBodyBehindAppBar: true,
      appBar: AppBar(
        toolbarHeight: 0,
        backgroundColor: Theme.of(context).scaffoldBackgroundColor, //状态栏的背景颜色
        systemOverlayStyle: SystemUiOverlayStyle.light,
      ),
      body: SafeArea(
        child: Container(
            padding: const EdgeInsets.only(top: 20),
            child: Container(
              padding: const EdgeInsets.all(16),
              child: Column(
                children: [
                  Row(
                    children: [
                      Expanded(
                        child: Text(SR.languageSetting.tr),
                      ),
                      InkWell(
                        onTap: () async {
                          ///如果要接收参数返回参数的形式
                          final index = await BoostNavigator.instance
                              .push(RouteGet.languageSettingPage);
                          LogU.log("返回的结果数据 $index");
                          _controller.getLanguage();
                        },
                        child: Row(
                          children: [
                            Obx(() => Text(
                                  _controller.languageStr.value,
                                  style: const TextStyle(fontSize: 12),
                                )),
                            const Icon(Icons.chevron_right)
                          ],
                        ),
                      )
                    ],
                  ),
                  SizedBox(
                    height: 10,
                  ),
                  Row(
                    children: [
                      Expanded(
                        child: Text(SR.themeSetting.tr),
                      ),
                      InkWell(
                        onTap: () async {
                          final index = await BoostNavigator.instance
                              .push(RouteGet.themeSettingPage);
                          LogU.log("返回的结果数据 $index");
                          _controller.getTheme();
                        },
                        child: Row(
                          children: [
                            Obx(
                              () => Text(
                                _controller.themeStr.value,
                                style: const TextStyle(fontSize: 12),
                              ),
                            ),
                            const Icon(Icons.chevron_right)
                          ],
                        ),
                      )
                    ],
                  )
                ],
              ),
            )),
      ),
    );
  }
}
